/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package com.kungkhies.persistence.entities;

import java.io.Serializable;
import java.math.BigInteger;
import java.util.Date;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import javax.xml.bind.annotation.XmlRootElement;

/**
 *
 * @author clayton
 */
@Entity 
@Table(name = "upload_stats")
@XmlRootElement
@NamedQueries(
{
    @NamedQuery(name = "UploadStats.findAll", query = "SELECT u FROM UploadStats u"),
    @NamedQuery(name = "UploadStats.findByKungkhieId", query = "SELECT u FROM UploadStats u WHERE u.kungkhieId = :kungkhieId"),
    @NamedQuery(name = "UploadStats.findByKungkherId", query = "SELECT u FROM UploadStats u WHERE u.kungkherId = :kungkherId"),
    @NamedQuery(name = "UploadStats.findByIsBlank", query = "SELECT u FROM UploadStats u WHERE u.isBlank = :isBlank"),
    @NamedQuery(name = "UploadStats.findByCount", query = "SELECT u FROM UploadStats u WHERE u.count = :count"),
    @NamedQuery(name = "UploadStats.findByUploadDate", query = "SELECT u FROM UploadStats u WHERE u.uploadDate = :uploadDate")
})
public class UploadStats implements Serializable 
{
    private static final long serialVersionUID = 1L;
    @Id
    @Basic(optional = false)
    @NotNull
    @Column(name = "kungkhie_id")
    private Long kungkhieId;
    @Column(name = "kungkher_id")
    private BigInteger kungkherId;
    @Basic(optional = false)
    @NotNull
    @Size(min = 1, max = 5)
    @Column(name = "is_blank")
    private String isBlank;
    @Column(name = "count")
    private BigInteger count;
    @Basic(optional = false)
    @NotNull
    @Column(name = "upload_date")
    @Temporal(TemporalType.TIMESTAMP)
    private Date uploadDate;
    @JoinColumn(name = "kungkhie_id", referencedColumnName = "kungkhie_id", insertable = false, updatable = false)
    @OneToOne(optional = false)
    private Kungkhie kungkhie;

    public UploadStats()
    {
    }

    public UploadStats(Long kungkhieId)
    {
        this.kungkhieId = kungkhieId;
    }

    public UploadStats(Long kungkhieId, String isBlank, Date uploadDate)
    {
        this.kungkhieId = kungkhieId;
        this.isBlank = isBlank;
        this.uploadDate = uploadDate;
    }

    public Long getKungkhieId()
    {
        return kungkhieId;
    }

    public void setKungkhieId(Long kungkhieId)
    {
        this.kungkhieId = kungkhieId;
    }

    public BigInteger getKungkherId()
    {
        return kungkherId;
    }

    public void setKungkherId(BigInteger kungkherId)
    {
        this.kungkherId = kungkherId;
    }

    public String getIsBlank()
    {
        return isBlank;
    }

    public void setIsBlank(String isBlank)
    {
        this.isBlank = isBlank;
    }

    public BigInteger getCount()
    {
        return count;
    }

    public void setCount(BigInteger count)
    {
        this.count = count;
    }

    public Date getUploadDate()
    {
        return uploadDate;
    }

    public void setUploadDate(Date uploadDate)
    {
        this.uploadDate = uploadDate;
    }

    public Kungkhie getKungkhie()
    {
        return kungkhie;
    }

    public void setKungkhie(Kungkhie kungkhie)
    {
        this.kungkhie = kungkhie;
    }

    @Override
    public int hashCode()
    {
        int hash = 0;
        hash += (kungkhieId != null ? kungkhieId.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object)
    {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof UploadStats))
        {
            return false;
        }
        UploadStats other = (UploadStats) object;
        if ((this.kungkhieId == null && other.kungkhieId != null) || (this.kungkhieId != null && !this.kungkhieId.equals(other.kungkhieId)))
        {
            return false;
        }
        return true;
    }

    @Override
    public String toString()
    {
        return "com.kungkhies.persistence.entities.UploadStats[ kungkhieId=" + kungkhieId + " ]";
    }

}
